<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>多行文字垂直居中-方法一table-cell</title>
        <style>
            /*不兼容IE6/7的写法*/
            /*.middleBox{
                display:table;
                height: 300px;
                width: 500px;
                background-color: #ff0;
            }
            .middle-inner{
                display:table-cell;
                vertical-align: middle;
                text-align: center;
            }*/
            /*兼容IE6/7的写法*/
            .middle-box{display: table; height: 300px; border:1px solid #ff0000; width:400px; margin:0 auto; position:relative;}
            .middle-inner{display: table-cell; vertical-align:middle; *position:absolute; *top:50%; *left:50%; width:100%; text-align:center;}
            .middle-inner p{position:relative; *top:-50%; *left:-50%;}
        </style>
        <!--[if lt IE 8]>
        <style>
        .middle-inner { position: absolute; top:50%;}
        .middle-inner p {position: relative; top: -50%}
        </style>
        <![endif]-->
    </head>
    <body>
        <!--[if lt IE 8]> <h1>CSS多行文字垂直居中的两种方法</h1> <![endif]-->
        <p>来源:<a href="http://caibaojian.com/css-vertical-middle.html">http://caibaojian.com/css-vertical-middle.html</a></p>
        <h2>方法一table-cell</h2>
        <div class="middle-box">
            <div class="middle-inner">
                <p><span class="suc-tip">前端开发博客，专注前端开发和web教程</span><br/><span class="suc-link">快捷入口：<a href="http://caibaojian.com">http://caibaojian.com</a></span></p>
                <p style="display:none;"><span class="suc-tip">5年的老博客，一直致力于WEB开发</span></p>
            </div>
        </div>
    </body>
</html>